package com.ctg.payroll2.service.empadmin.Impl;

import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import sun.misc.CEStreamExhausted;

import com.ctg.payroll2.bean.filter.empadmin.CsEmpDimissionFilter;
import com.ctg.payroll2.bean.po.CsEmpDimission;
import com.ctg.payroll2.dao.empadmin.CsEmpDimissionDao;
import com.ctg.payroll2.service.BaseService;
import com.ctg.payroll2.service.empadmin.CsEmpDimissionService;
import com.ctg.platform.util.Page;

public class CsEmpDimissionServiceImp extends BaseService implements
		CsEmpDimissionService {
	private CsEmpDimissionDao dao;

	/**
	 * @param dao
	 *            设置dao
	 */
	public void setDao(CsEmpDimissionDao dao) {
		this.dao = dao;
	}

	public Page queryEmpDimissionPageByFilter(CsEmpDimissionFilter filter) {
		return dao.queryEmpDimissionPageByFilter(filter);
	}

	public void updateDimissionEmployee(CsEmpDimission csEmpDimission)
			throws SQLException {
		if (csEmpDimission.getDisId() == null) {
			dao.insertEmpDimission(csEmpDimission);
		} else {
			dao.updateEmpDimission(csEmpDimission);
		}
		dao.updateEmployee(csEmpDimission);
	}

	public int deleteEmpDimission(String ids) throws SQLException {
		return dao.deleteEmpDimission(ids);
	}

	public CsEmpDimission queryById(Long id) throws SQLException {
		CsEmpDimission ced = new CsEmpDimission();
		List<CsEmpDimission> list = dao.queryById(id);
		ced = list.get(0);
		return ced;
	}

	public void updateStatusById(CsEmpDimission csEmpDimission,
			Map<String, Object> map) throws SQLException {
		dao.updateStatusById(csEmpDimission, map);
	}
}
